package com.stm.bi.jdbc;

/**
 * @author chenyingjun
 * @ClassDesc ES时间类型枚举
 * @date 2023/02/02 9:20
 **/
public enum DataSourceEnum {
    ODS("com.stm.bi.repository.ods",MultiDataSourceConfig.DATASOURCE_ODS_PREFIX),
    DMP("com.stm.bi.repository.dmp",MultiDataSourceConfig.DATASOURCE_DMP_PREFIX),
    DATA_SYNC("com.stm.bi.repository.datasync",MultiDataSourceConfig.DATASOURCE_DATA_SYNC_PREFIX),
    REPORT("com.stm.bi.repository.report",MultiDataSourceConfig.DATASOURCE_REPORT_PREFIX);
    private final String packageName;
    /**
     * 字段类型描述
     */
    private final String dataSource;

    DataSourceEnum(String packageName, String dataSource) {
        this.packageName = packageName;
        this.dataSource = dataSource;
    }

    public static DataSourceEnum getDataSourceEnum(String packageName) {
        for (DataSourceEnum ut : DataSourceEnum.values()) {
            if (packageName.startsWith(ut.getPackageName())) {
                return ut;
            }
        }
        return null;
    }

    public String getPackageName() {
        return packageName;
    }

    public String getDataSource() {
        return dataSource;
    }
}
